package com.xtz.mapper;

import com.xtz.domain.Dish;
import com.xtz.domain.DishFlavor;
import com.xtz.dto.AddDishDto;
import com.xtz.vo.DishVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * date: 2022/5/9 21:12
 *
 * @author xietianze
 */
@Mapper
@Repository
public interface AdminDishMapper {

    /**
     * 添加菜品
     * @param dish
     * @return
     */
    int addDish(Dish dish);

    /**
     * 添加喜爱
     * @param dishFlavor
     * @return
     */
    int addDishFlavor(DishFlavor dishFlavor);

    /**
     * 根据id查菜品信息
     */
    Dish selectById(@Param("id") String id);

    /**
     * 分页
     * @param page
     * @param pageSize
     * @param name
     * @return
     */
    List<DishVo> selectPageByName(@Param("page")Integer page,@Param("pageSize") Integer pageSize,@Param("name")String name);

    /**
     * 总条数
     * @param name
     * @return
     */
    Long selectCountByName(@Param("name") String name);

    /**
     * 菜单列表
     * @param condition
     * @return
     */
    List<DishVo> selectByCondition(Map<String, Object> condition);

    List<DishVo> selectByCategoryId(String categoryId);

    List<DishVo> selectByTwo(String categoryId,Integer status);

    List<DishFlavor> selectByDishId(String dishId);

    List<DishFlavor> selectFlavor(List list);

    /**
     * 通过id删除菜品
     * @param ids
     * @return
     */
    int deleteDishByIds(@Param("ids") List<String> ids);

    /**
     * 通过id删除口味
     * @param dish_id
     * @return
     */
    int deleteDishFlavorByIds(@Param("ids") List<String> dish_id);

    int updatadishes(Dish dish);

    int deleteById(String dishId);

    int updateStatus(@Param("status") Integer status,@Param("ids") List<String> id);


}
